//
//  MWMineFooterView.m
//  XiRan-iOS
//
//  Created by liuyiming on 2019/12/20.
//  Copyright © 2019 Wood. All rights reserved.
//

#import "MWMineFooterView.h"

@interface MWMineFooterView ()

@property(nonatomic, strong) UIButton *logoutBtn;

@end

@implementation MWMineFooterView

- (instancetype)initWithFrame:(CGRect)frame {
    if (!(self = [super initWithFrame:frame])) {
        return nil;
    }

    [self setupPageSubviews];

    return self;
}

- (void)logoutAction:(UIButton *)sender {
    if(self.block) {
        self.block();
    }
}

- (void)setupPageSubviews {
    _logoutBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _logoutBtn.layer.cornerRadius = 5;
    _logoutBtn.layer.masksToBounds = YES;
    _logoutBtn.titleLabel.font = MWFont(14);
    [_logoutBtn setTitle:[[MWConfigManager manager] objectForKey:@"logout" defaultValue:@"退出登录"] forState:UIControlStateNormal];
    [_logoutBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_logoutBtn setBackgroundImage:[UIImage imageWithColor:MWHexColor(@"#1E1934")] forState:UIControlStateNormal];
    [_logoutBtn addTarget:self action:@selector(logoutAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_logoutBtn];
    
    [_logoutBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(40);
        make.left.equalTo(self).offset(20);
        make.right.equalTo(self).offset(-20);
        make.height.equalTo(@40);
    }];
}


@end
